using DapperExtensionsNew;
using System;

namespace Microsoft.Extensions.DependencyInjection
{
	public static class DapperBuilderExtensions
	{
		public static IDapperBuilder AddConnectionString(this IDapperBuilder builder, string connectionName)
		{
			if (connectionName == null)
			{
				throw new ArgumentNullException("connectionName");
			}
			ConnectionStringConfig.AddConnectionString(connectionName, builder.Configuration.GetSection(connectionName).Value);
			return builder;
		}

		public static IDapperBuilder AddConnectionString(this IDapperBuilder builder, string connectionName, string connectionString)
		{
			if (connectionName == null)
			{
				throw new ArgumentNullException("connectionName");
			}
			if (connectionString == null)
			{
				throw new ArgumentNullException("connectionString");
			}
			ConnectionStringConfig.AddConnectionString(connectionName, connectionString);
			return builder;
		}
	}
}
